﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BlueCMS.Core.Data.Query.Common
{
    public class ConditionColumn : Condition
    {
        public ConditionColumn(string nameOrExpression) : base(nameOrExpression, BinaryOperators.FieldOrExpression) { }

        public ConditionColumn(SelectQuery query) : base(query, BinaryOperators.SubQuery) { }

        public ConditionUnaryOperator Exists(SelectQuery query)
        {
            ConditionUnaryOperator exists = new ConditionUnaryOperator(BinaryOperators.Exists, query);
            Next = exists;
            return exists;
        }

        public ConditionUnaryOperator NotExists(SelectQuery query)
        {
            ConditionUnaryOperator exists = new ConditionUnaryOperator(BinaryOperators.NotExists, query);
            Next = exists;
            return exists;
        }

        public ConditionStartGroup StartGroup()
        {
            ConditionStartGroup start = new ConditionStartGroup();
            Next = start;
            return start;
        }
    }
}
